﻿<Window x:Class="DoubanFM.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:tb="clr-namespace:Hardcodet.Wpf.TaskbarNotification"
        mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        d:DesignHeight="295" d:DesignWidth="225"
        Title="豆瓣电台桌面版" WindowStyle="None" AllowsTransparency="True" SizeToContent="WidthAndHeight" Background="Transparent" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Icon="/DoubanFM;component/db.ico" Topmost="True" ShowInTaskbar="False">
    <!--设定快捷键-->
    <Window.Resources>
        <RoutedUICommand x:Key="PlayOrPauseKC" />
        <RoutedUICommand x:Key="NextKC" />
        <RoutedUICommand x:Key="LoveKC" />
        <RoutedUICommand x:Key="DiscardKC" />
        <RoutedUICommand x:Key="OpenMainPanelKC" />
        <RoutedUICommand x:Key="LoginKC" />
        <RoutedUICommand x:Key="OpenChannelKC" />
    </Window.Resources>
    <Window.InputBindings>
        <KeyBinding Modifiers="Control" Key="P" Command="{StaticResource PlayOrPauseKC}"/>
        <KeyBinding Modifiers="Control" Key="N" Command="{StaticResource NextKC}"/>
        <KeyBinding Modifiers="Control" Key="F" Command="{StaticResource LoveKC}"/>
        <KeyBinding Modifiers="Control" Key="D" Command="{StaticResource DiscardKC}"/>
        <KeyBinding Modifiers="Control" Key="O" Command="{StaticResource OpenMainPanelKC}"/>
        <KeyBinding Modifiers="Control" Key="L" Command="{StaticResource LoginKC}"/>
        <KeyBinding Modifiers="Control" Key="C" Command="{StaticResource OpenChannelKC}"/>
    </Window.InputBindings>
    <Window.CommandBindings>
        <CommandBinding Command="{StaticResource PlayOrPauseKC}" Executed="PlayOrPauseKC"/>
        <CommandBinding Command="{StaticResource NextKC}" Executed="NextClickKC"/>
        <CommandBinding Command="{StaticResource LoveKC}" Executed="loveClickKC"/>
        <CommandBinding Command="{StaticResource DiscardKC}" Executed="DiscardClickKC"/>
        <CommandBinding Command="{StaticResource OpenMainPanelKC}" Executed="ShowClickKC"/>
        <CommandBinding Command="{StaticResource LoginKC}" Executed="LoginClickKC"/>
        <CommandBinding Command="{StaticResource OpenChannelKC}" Executed="ChannelClickKC"/>
    </Window.CommandBindings>
    <Grid MouseLeftButtonDown="DragMove">
        <Grid.RowDefinitions>
            <RowDefinition Height="36" />
            <RowDefinition Height="155" />
            <RowDefinition Height="66" />
        </Grid.RowDefinitions>
        <Border x:Name="mainBorder" CornerRadius="10" Background="DimGray" Width="205" Height="255" Margin="0,0,0,0" Grid.RowSpan="3" />
        <!--标题行-->
        <Canvas Width="205" Grid.Row="0">
            <Label x:Name="ChanName" Width="80" Canvas.Left="5" Canvas.Top="7" Content="fm.公共兆赫" Foreground="White" FontWeight="Bold" Style="{StaticResource labelStyle}" MouseLeftButtonDown="ChannelClick" />
            <Path x:Name="headPath" Canvas.Left="80" Canvas.Top="3" Data="M0,0 L10,0 20,15 10,30 0,30 10,15z" Fill="#FF585858" Height="33" Opacity="0.8" />
            <Label x:Name="subChanName" Width="Auto" MaxWidth="100" Canvas.Left="100" Canvas.Top="7" Content="华语兆赫" Foreground="White" FontWeight="Bold" Style="{StaticResource labelStyle}" />
            <Image x:Name="CloseButton" Width="30" Height="30" Canvas.Left="173" Canvas.Top="0" Source="/DoubanFM;component/Images/Close.png" Style="{StaticResource imageStyle}" ToolTip="关闭" MouseLeftButtonDown="CloseClick" />
            <Separator Height="1" Width="201" Canvas.Left="2" Canvas.Bottom="0" Background="#FF585858"/>
        </Canvas>
        <!--专辑封面-->
        <Canvas x:Name="albumCanvas" Grid.Row="1" Width="205">
            <Image x:Name="Album" Canvas.Left="25" Canvas.Top="0" Width="150" Height="150" Source="/DoubanFM;component/Images/Album_Large.jpg" Cursor="Hand" ToolTipService.ShowOnDisabled="True" ToolTip="稍后点击试试..." MouseLeftButtonDown="AlbumClick" />
            <Border Width="200" Height="15" Canvas.Left="1" Canvas.Bottom="5" Background="Black" Opacity="0.5"/>
            <!--<ProgressBar x:Name="songExtent" Canvas.Left="3" Canvas.Bottom="5" Height="15" Width="200" Background="Black" BorderBrush="Transparent" BorderThickness="0" Opacity="0.5">
                <ProgressBar.Foreground>
                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                        <GradientStop Color="#FF33E812" Offset="0" />
                        <GradientStop Color="#FFF28C16" Offset="1" />
                    </LinearGradientBrush>
                </ProgressBar.Foreground>
            </ProgressBar>-->
            <TextBlock x:Name="lyricText" Width="200" MaxHeight="15"  Canvas.Left="1" Canvas.Bottom="3" Text="" TextAlignment="Center"><TextBlock.Foreground><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFEB1E1E" Offset="0" /><GradientStop Color="#FFEBCC12" Offset="1" /></LinearGradientBrush></TextBlock.Foreground></TextBlock>
            <Separator Height="1" Width="201" Canvas.Left="2" Canvas.Bottom="0" Background="#FF585858"/>
        </Canvas>
        <!--歌曲信息-->
        <Canvas Grid.Row="2" Width="205">
            <MediaElement x:Name="player" Canvas.Left="0" Canvas.Top="0" Height="1" Width="1" LoadedBehavior="Manual" UnloadedBehavior="Manual" MediaOpened="player_Open" MediaEnded="player_End" />
            <ProgressBar x:Name="songExtent" Canvas.Left="2" Canvas.Top="-3" Height="2" Width="200" Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
                <ProgressBar.Foreground>
                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                        <GradientStop Color="#FF33E812" Offset="0" />
                        <GradientStop Color="#FFF28C16" Offset="1" />
                    </LinearGradientBrush>
                </ProgressBar.Foreground>
            </ProgressBar>
            <TextBlock x:Name="songName" Canvas.Left="0" Canvas.Top="2" Width="205" MaxWidth="200" Text="" Foreground="White" TextAlignment="Center" />
            <TextBlock x:Name="artist" Canvas.Left="0" Canvas.Top="17" Width="175" MaxWidth="200" Text="" Foreground="SkyBlue" TextAlignment="Right" FontWeight="ExtraBold" />
            <Image x:Name="playButton" Canvas.Left="25" Canvas.Top="35" Width="25" Height="25" Source="/DoubanFM;component/Images/Pause.png" Style="{StaticResource imageStyle}" ToolTip="暂停" MouseLeftButtonDown="PlayOrPause" />
            <Image x:Name="nextButton" Canvas.Left="65" Canvas.Top="35" Width="25" Height="25" Source="/DoubanFM;component/Images/Next.png" Style="{StaticResource imageStyle}" ToolTip="下一首" MouseLeftButtonDown="NextClick" />
            <Image x:Name="loveButton" Canvas.Left="105" Canvas.Top="35" Width="25" Height="25" Source="/DoubanFM;component/Images/Heart.png" Style="{StaticResource imageStyle}" ToolTip="喜欢" MouseLeftButtonDown="loveClick" />
            <Image x:Name="discardButton" Canvas.Left="145" Canvas.Top="35" Width="25" Height="25" Source="/DoubanFM;component/Images/Garbage.png" Style="{StaticResource imageStyle}" ToolTip="仅fm.私人兆赫有效" ToolTipService.ShowOnDisabled="True" Opacity="0.5" IsEnabled="False" MouseLeftButtonDown="DiscardClick" />
        </Canvas>
        <tb:TaskbarIcon x:Name="notifyicon" IconSource="db.ico" ToolTipText="豆瓣电台--让好音乐与您不期而遇！">
            <!-- Set a simple context menu  -->
            <tb:TaskbarIcon.ContextMenu>
                <ContextMenu x:Name="contextMenu">
                    <MenuItem Header="显/隐主界面" Click="ShowClick">
                        <MenuItem.Icon>
                            <Image Source="/DoubanFM;component/Images/Check.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="登陆" Click="LoginClick">
                        <MenuItem.Icon>
                            <Image Source="/DoubanFM;component/Images/User.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="设置" Click="SettingClick">
                        <MenuItem.Icon>
                            <Image Source="/DoubanFM;component/Images/Settings.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="帮助" Click="HelpClick">
                        <MenuItem.Icon>
                            <Image Source="/DoubanFM;component/Images/Help.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="关于" Click="AboutClick">
                        <MenuItem.Icon>
                            <Image Source="/DoubanFM;component/Images/Information.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="退出" Click="CloseClick">
                        <MenuItem.Icon>
                            <Image Source="/DoubanFM;component/Images/Close.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                </ContextMenu>
            </tb:TaskbarIcon.ContextMenu>
        </tb:TaskbarIcon>
    </Grid>
</Window>
